package com.echat.messagesender.sender.model;

import com.echat.messagesender.sender.util.StringUtils;
import lombok.Builder;
import lombok.Data;

import javax.persistence.Column;
import javax.persistence.Id;
import java.time.LocalDateTime;

/**
 * @功能:
 * @作者:chanson
 * @时间:2018/9/9 21:07
 */
@Data
@Builder
public class EmailTemplateMapping {

    @Id
    private Long id;

    private Long templateId;

    /** 【ps】平台的模板id是字符串类型 */
    private String platformTemplateId;

    private Long platformId;

    @Column(name="create_datetime")
    private LocalDateTime createTime;

    @Column(name="modify_datetime")
    private LocalDateTime modifyTime;

    public void check(){
        if (templateId == null) {
            throw new IllegalArgumentException("templateId不能为空");
        }
        if (platformId == null) {
            throw new IllegalArgumentException("platformId不能为空");
        }
        if (StringUtils.isEmpty(platformTemplateId)) {
            throw new IllegalArgumentException("platformTemplateId不能为空");
        }
    }


}
